class Food{
	constructor(select){
		this.map=document.querySelector(select)
		//创建
		this.food = document.createElement("div")
		//样式
		this.food.className = "food"
		//放到map
		this.map.appendChild(this.food)
		//this.x = 0
		//this.y = 0
		this.foodPos()
	}
	foodPos(){
		const w_nub = this.map.clientWidth/10
		const h_nub = this.map.clientHeight/10
		//随机数范围
		let n1 = Math.floor(Math.random()*w_nub) 
		let n2 = Math.floor(Math.random()*h_nub)

		this.x = n1*10;
		this.y = n2*10;
		
		this.food.style.left = this.x + "px"
		this.food.style.top = this.y  + "px"
	}
}